class SessionsController < ApplicationController
  def new

  end
   
  def create
      u = Utilisateur.authenticate(params[:name], params[:password])
      if(u)
          session[:USER_ID] = u.id
          session[:USER_NAME] = u.name
          redirect_to('/homes')
      else       
          flash[:notice] = "ECHEC DE CONNEXION"
          redirect_to ('/homes')
      end
  end
	
	def logout
	session[:USER_ID] = nil
	redirect_to('/homes')
	end
end
